bitkeeper revision 1.1699 (42a84d06sZDrQ46g-Bcc7JqWMygr2Q)
authorakw27@arcadians.cl.cam.ac.uk <akw27@arcadians.cl.cam.ac.uk>
Thu, 9 Jun 2005 14:07:02 +0000 (14:07 +0000)
committerakw27@arcadians.cl.cam.ac.uk <akw27@arcadians.cl.cam.ac.uk>
Thu, 9 Jun 2005 14:07:02 +0000 (14:07 +0000)
Fix a bug with snapshots that was introduced with the crc code.

tools/blktap/Makefile
tools/blktap/requests-async.c
tools/blktap/vdi.c

index a0c197aedbbe250179517942aefa4e6a4655ec64..6ee79ada9c9d52feecce41d31a21fe45232ec3d1 100644 (file)
@@ -80,7 +80,7 @@ install: all
        $(INSTALL_PROG) $(IBINS) $(DESTDIR)/$(BLKTAP_INSTALL_DIR)
 
 clean:
-       rm -rf *.a *.so *.o *.rpm $(LIB) *~ $(DEPS) xen TAGS blkdump $(VDI_TOOLS) parallax
+       rm -rf *.a *.so *.o *.rpm $(LIB) *~ $(DEPS) xen TAGS blkdump $(VDI_TOOLS) parallax vdi_unittest
 
 rpm: all
        rm -rf staging
index 76083c7cc13604e4289e803631e987b43d0350a8..f1e0bc8425170e246a49729af543c21dd273cd2f 100755 (executable)
@@ -50,6 +50,14 @@ struct io_req {
 \r
 void clear_w_bits(radix_tree_node node) \r
 {\r
+    int i;
+    for (i=0; i<RADIX_TREE_MAP_ENTRIES; i++)
+        node[i] = node[i] & ONEMASK;
+    return;
+}
+
+void clear_L3_w_bits(radix_tree_node node) 
+{
     int i;
     for (i=0; i<RADIX_TREE_MAP_ENTRIES; i+=2)
         node[i] = node[i] & ONEMASK;
@@ -513,7 +521,7 @@ static void write_cb(struct io_ret r, void *param)
     \r
        DPRINTF("READ_L3_L2f\n");\r
         node = (radix_tree_node) IO_BLOCK(r);\r
-        clear_w_bits(node);\r
+        clear_L3_w_bits(node);
         if (node == NULL) goto fail;\r
         a    = node[L2_IDX(req->vaddr)];\r
         addr = getid(a);\r
@@ -613,7 +621,7 @@ static void write_cb(struct io_ret r, void *param)
     \r
        DPRINTF("READ_L3_L1f\n");\r
         node = (radix_tree_node) IO_BLOCK(r);\r
-        clear_w_bits(node);\r
+        clear_L3_w_bits(node);
         if (node == NULL) goto fail;\r
         a    = node[L2_IDX(req->vaddr)];\r
         addr = getid(a);\r
index 50ead81f01491689954d9883fbfc5d04efefb8d6..f3181b86b2be3c2bf69b36111bb059d6c53f9a82 100644 (file)
@@ -14,6 +14,7 @@
 #include <pthread.h>
 #include "blockstore.h"
 #include "block-async.h"
+#include "requests-async.h"
 #include "radix.h"
 #include "vdi.h"
                     
@@ -161,28 +162,6 @@ void vdi_put(vdi_t *vdi)
     freeblock(vdi);
 }
 
-u64 vdi_lookup_block(vdi_t *vdi, u64 vdi_block, int *writable)
-{
-    u64 gblock;
-    
-    gblock = lookup(VDI_HEIGHT, vdi->radix_root, vdi_block);
-    
-    if (writable != NULL) *writable = iswritable(gblock);
-
-    return getid(gblock);
-}
-
-void vdi_update_block(vdi_t *vdi, u64 vdi_block, u64 g_block)
-{
-    u64 id;
-    
-    /* updates are always writable. */
-    id = writable(g_block);
-    
-    vdi->radix_root = update(VDI_HEIGHT, vdi->radix_root, vdi_block, id);
-    writeblock(vdi->block, vdi);
-}
-
 void vdi_snapshot(vdi_t *vdi)
 {
     snap_rec_t rec;